/**
 * 
 */
package ai.ann;


/** 
 * @author Object
 * @proyect MyFirstNeuronalNetwork
 * @package neuronalNetwork
 */
public abstract class LayerDirect {

	/**
	 * @uml.property   name="weightMatrix"
	 */
	protected double[][] weightMatrixs;

	/**
	 * Getter of the property <tt>weightMatrix</tt>
	 * @return  Returns the weightMatrixs.
	 * @uml.property  name="weightMatrix"
	 */
	public double[][] getWeightMatrix() {
		return weightMatrixs;
	}

	/**
	 * Setter of the property <tt>weightMatrix</tt>
	 * @param weightMatrix  The weightMatrixs to set.
	 * @uml.property  name="weightMatrix"
	 */
	public void setWeightMatrix(double[][] weightMatrix) {
		weightMatrixs = weightMatrix;
	}

	/**
	 * @uml.property   name="outMatrix"
	 */
	protected double[] outMatrixs;

	/**
	 * Getter of the property <tt>outMatrix</tt>
	 * @return  Returns the outMatrixs.
	 * @uml.property  name="outMatrix"
	 */
	public double[] getOutMatrix() {
		return outMatrixs;
	}

	/**
	 * Setter of the property <tt>outMatrix</tt>
	 * @param outMatrix  The outMatrixs to set.
	 * @uml.property  name="outMatrix"
	 */
	protected void setOutMatrix(double[] outMatrix) {
		outMatrixs = outMatrix;
	}

	/**
	 * @uml.property  name="rows"
	 */
	protected int rows;

	/**
	 * Getter of the property <tt>rows</tt>
	 * @return  Returns the rows.
	 * @uml.property  name="rows"
	 */
	public int getRows() {
		return rows;
	}

	/**
	 * Setter of the property <tt>rows</tt>
	 * @param rows  The rows to set.
	 * @uml.property  name="rows"
	 */
	public void setRows(int rows) {
		this.rows = rows;
		input.setColumms(rows);
		output.setRows(rows);
	}

	public double[] stimulation(double[] patterns){
		return null;
	}
	
	/**
	 */
	/*public void setWeightMatrix(String path){
		FileReader fileReader = null;
		BufferedReader bufferedReader = null;
		try {
			fileReader = new FileReader(path);
			bufferedReader = new BufferedReader(fileReader);
		} catch (FileNotFoundException e) {
			System.out.println("[Layer]-setWeightMatrix()-Error al Abrir archivo para lectura");
			e.printStackTrace();
		}
		try {
			int i = 0;
			String linea;
			while((linea = bufferedReader.readLine())!= null){
				weightMatrixs[i] = Double.parseDouble(linea);
				i++;
			}
			if(i < rows){
				System.out.println("[Layer]-setWeightMatrix()-Error la cantidad de datos inferior a la matriz de peso");
			}
		} catch (NumberFormatException e) {
			System.out.println("[Layer]-setWeightMatrix()-Error linea leida no es numero");
			e.printStackTrace();
		} catch (IOException e) {
			System.out.println("[Layer]-setWeightMatrix()-Error al leer el archivo");
			e.printStackTrace();
		} catch (IndexOutOfBoundsException e) {
			System.out.println("[Layer]-setWeightMatrix()-Error la cantidad de datos sobrepasa a la matriz de peso");
			e.printStackTrace();
		}
	}*/

	/**
	 * @uml.property   name="input"
	 * @uml.associationEnd   inverse="output:neuronalNetwork.SynapseDirect"
	 * @uml.association   name="Input"
	 */
	protected SynapseDirect input;

	/**
	 * Getter of the property <tt>input</tt>
	 * @return  Returns the output.
	 * @uml.property  name="input"
	 */
	public SynapseDirect getInput() {
		return input;
	}

	/**
	 * Setter of the property <tt>input</tt>
	 * @param input  The output to set.
	 * @uml.property  name="input"
	 */
	public void setInput(SynapseDirect input) {
		this.input = input;
		input.setColumms(rows);
		input.setOutput(this);
	}

	/**
	 * @uml.property   name="output"
	 * @uml.associationEnd   inverse="input:neuronalNetwork.SynapseDirect"
	 * @uml.association   name="OutPut"
	 */
	protected SynapseDirect output;

	/**
	 * Getter of the property <tt>output</tt>
	 * @return  Returns the output1.
	 * @uml.property  name="output"
	 */
	public SynapseDirect getOutput() {
		return output;
	}

	/**
	 * Setter of the property <tt>output</tt>
	 * @param output  The output1 to set.
	 * @uml.property  name="output"
	 */
	public void setOutput(SynapseDirect output) {
		this.output = output;
		output.setRows(rows);
		output.setInput(this);
	}

		
	/**
	 */
	public LayerDirect(){
	}
			
	/**
	 */
	public LayerDirect(int rows){
		this.rows = rows;
		outMatrixs = new double[rows];
	}

}
